<template>
  <div>
    <basic-table
      :table-title="tableTitle"
      :data-source="dataSource"
      :data-params="dataParams"
      :multiple-table="false"
      class="mt-4"
    >
      <template v-slot:isPass="scope">
        {{ scope.row.OneCensorIsPass === 0 ? '否' : '是' }}
      </template>
      <template v-slot:check="scope">
        <span style="color: #0087FE; cursor: pointer;" @click="check(scope.row)">
          查看
        </span>
      </template>
    </basic-table>

    <Modal
      :data-source="getCensorPersons"
      :data-params="params"
      :show="dialogVisible"
      :descriptions-info="info"
      :descriptions-list="descriptionsList"
      :table-title="tableTitle2"
      :show-type="'both'"
      @close="close"
    />
  </div>
</template>
<script>
import BasicTable from '@/components/BasicTable/index.vue'
import Modal from '@/components/Modal/Index'

import { getCensors, getCensorDetail, getCensorPersons } from '@/api/project'

export default {
  name: 'BasicInfos',
  components: { BasicTable, Modal },
  props: {
    projectId: { type: String, default: '' }
  },
  data() {
    return {
      dataSource: () => getCensors,
      dataParams: {},
      tableTitle: [
        {
          label: '数据等级',
          value: 'DataLevel',
          show: true,
          type: 'text'
        },
        {
          label: '施工图审查合格书编号',
          value: 'CensorNum',
          show: true,
          type: 'text'
        },
        {
          label: '省级施工图审查合格书编号',
          value: 'ProvinceCensorNum',
          show: true,
          type: 'text'
        },
        {
          label: '施工图审查机构名称',
          value: 'CensorComName',
          show: true,
          type: 'text'
        },
        {
          label: '一次审查是否通过',
          value: 'OneCensorIsPass',
          show: true,
          type: 'slot',
          slot: 'isPass'
        },
        {
          label: '审查完成时间',
          value: 'CensorEndDate',
          show: true,
          type: 'text'
        },
        {
          label: '记录登记日期',
          value: 'CreateDate',
          show: true,
          type: 'text'
        },
        {
          label: '详情',
          show: true,
          type: 'slot',
          slot: 'check'
        }
      ],
      descriptionsList: {
        'ProjectName': '项目名称',
        'ConPrjName': '工程名称',
        'ProvinceCensorNum': '省级施工图审查合格书编号',
        'CensorNum': '施工图审查合格书编号',
        'CensorEndDate': '审查完成时间',
        'PrjSize': '建设规模描述',
        'OneCensorIsPass': '一次审查通过',
        'OneCensorVioCount': '一次审查时违反强制性标准数',
        'OneCensorVioContent': '一次审查时违反强制性标准条目',
        'RegistrationDate': '记录登记日期',
        'IsJoinCensor': '是否联合审查',
        'CensorComName': '施工图审查机构名称',
        'CensorComNum': '审图机构统一社会信用代码',
        'XfCensorDate': '消防设计审核时间',
        'XfCensorNum': '消防审查合格书编号',
        'XfCensorComName': '消防审查机构',
        'RfCensorDate': '人防设计审核时间',
        'RfCensorNum': '人防审查合格书编号',
        'RfCensorComName': '人防审查机构',
        'DataSource': '数据来源',
        'DataLevel': '数据等级'
      },
      info: {},
      dialogVisible: false,
      tableTitle2: [
        {
          label: '施工图审查合格书编号',
          value: 'CensorNum',
          show: true,
          type: 'text'
        },
        {
          label: '所在单位',
          value: 'ComName',
          show: true,
          type: 'text'
        },
        {
          label: '承担角色',
          value: 'WorkerTitle',
          show: true,
          type: 'text'
        },
        {
          label: '姓名',
          value: 'PerName',
          show: true,
          type: 'text'
        },
        {
          label: '证件号码',
          value: 'IdCard',
          show: true,
          type: 'text'
        }
      ],
      getCensorPersons: () => getCensorPersons,
      params: null
    }
  },
  created() {
    this.dataParams.projectId = this.projectId
  },
  methods: {
    close(v) {
      this.dialogVisible = v
    },
    //  查看
    check(v) {
      this.dialogVisible = true
      // 请求详情 info
      this.params = {
        id: v.Id,
        projectId: this.projectId
      }
      // 请求数据
      getCensorDetail(this.params).then(res => {
        if (res.code === 200) {
          this.info = res.data.detail
        }
      })
    }
  }
}
</script>

<style scoped>

</style>
